<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title></title>
		<link rel="stylesheet" type="text/css" href="./Public/Home/css/index.css">
		<link rel="stylesheet" type="text/css" href="./Public/Home/css/shoppingcart/shoppincart.css">
		<script src="./Public/Home/js/jquery-1.7.2.min.js" type="text/javascript" charset="utf-8"></script>
		<script src="./Public/Home/js/JS.js" type="text/javascript" charset="utf-8"></script>
		<script src="./Public/Home/js/content/count.js" type="text/javascript" charset="utf-8"></script>
	</head>
	<body>
		{{include file="../Common/headers"}}
		<div id="logo_line">
			<div class="shopping_logo">
				<a href="index.php">
					<img src="./Public/Home/images/shopping/1.jpg">
				</a>
				<div class="shopping_procedure">
					<span class="current">我的购物车</span>
					<span>填写订单</span>
					<span>完成订单</span>
				</div>
			</div>
		</div>

		<div id="cart">
			<ul class="cart_ul">
				<li class="f1">
					<input type="checkbox" name="" class="checkow">
					</a>
					<span class="quanxuan">全选</span>
				</li>
				<li class="f2">
					商品信息
				</li>
				<li class="f3">
					单价（元）
				</li>
				<li class="f3">
					数量
				</li>
				<li class="f3">
					金额（元）
				</li>
				<li class="f4">
					操作
				</li>
			</ul>

			<form action="{{U('Cart/closed')}}" method="post">
				{{if value='isset($data)'}}
				{{foreach from="$data" key="$k" value="$v"}}
				<div class="fn-shop" style="margin-top: 20px;">
					<div class="shop_title">
						<input type="checkbox" name="" class="checkow" checked="checked">
						<i></i>
						<a href="" class="stop_name">
							{{$v['options']['bname']}}
						</a>
						<a href="">
							<img src="./Public/Home/images/shopping/1.gif" alt="">
						</a>
					</div>
					<div class="shopping_bb">
						<div class="row">
							<div class="row1">
								<input type="checkbox" name="checkow[]" checked="checked" class="checkow" value="{{$k}}">
							</div>
							<div class="row2">
								<img style="width: 80px;height: 80px;" src="{{$v['options']['src']}}" alt="">
							</div>
							<div class="row_name">
								<a href="{{U('Content/index',['aid'=>$v['id'],'bid'=>$v['options']['bid']])}}">
									{{$v['name']}}{{$v['options']['combine']}}
								</a>
							</div>
							<div class="row3">
								<span>¥{{$v['price']}}</span>
							</div>
							<div class="row4">
								<a href="javascript:;" class="sale_jian" key="{{$k}}"></a>
								<input type="text" name="" class="inpt" maxlength="3" value="{{$v['num']}}">
								<a href="javascript:;" class="sale_jia" key="{{$k}}"></a>
							</div>

							<script type="text/javascript">$(function() {
	$(".sale_jia").click(function() {
		indexs = $(".sale_jia").index(this);
		var inpt = $(this).siblings('input').val();
		var key = $(this).attr('key');
		data = {};
		data.inpt = inpt;
		data.key = key;

		$.ajax({
			type: "post",
			url: "{{U('Cart/price')}}",
			data: {
				data
			},
			dataType: 'json',
			success: function(phpData) {
				//console.log(phpData);
				$(".six").eq(indexs).html('¥' + phpData.total);
				$("#cart .fn-shop .shopping_bb .total .total_red").eq(indexs).html('¥' + phpData.total);
				$(".price").html('¥' + phpData.countNum);
			}

		});
	})
	$(".sale_jian").click(function() {

		index = $(".sale_jian").index(this);

		var inpt = $(this).siblings('input').val();

		var key = $(this).attr('key');
		data = {};
		data.inpt = inpt;
		data.key = key;
		$.ajax({
			type: "post",
			url: "{{U('Cart/price')}}",
			data: {
				data
			},
			dataType: 'json',
			success: function(phpData) {
				//console.log(phpData);
				$(".six").eq(index).html('¥' + phpData.total);
				$(".total_red").eq(index).html('¥' + phpData.total);
				$(".price").html('¥' + phpData.countNum);
			}
		});

	})
})</script>

							<div class="row6">
								<span class="six">¥{{$v['total']}}</span>
							</div>
							<div class="row5">
								<p>
									<a href="{{U('Cart/del',['key'=>"{$k}"])}}" class="fn_remove_product">
										删除
									</a>
								</p>
							</div>
						</div>
						<div class="total">
							<span class="total_count">店铺合计</span>
							<span class="total_red">¥{{$v['total']}}</span>
						</div>

					</div>
				</div>
				{{endforeach}}
				{{else}}
					{{go('Cart/noCart')}}
				{{endif}}
		</div>
		<div id="shopping_total">
			<div class="shopping_total_left">
				<input type="checkbox" name="" class="checkow">
				<span class="quanxuan" id="chkAll">全选</span>
				<!--<span class="fn_num">已选择<font color="red">{{if value='isset($count)'}}{{$count['total_rows']}}{{else}}0{{endif}}</font>件商品</span>-->
			</div>
			<div class="shopping_total_right">
				{{if value="!empty($_SESSION['user'])"}}
					<input type="submit" class="total_btn" value="结 算">
				{{else}}
					<a href="{{U('Login/index')}}" class="total_btn btn" value="" />结 算</a>	
				{{endif}}
				<div class="subtotal">
					<span class="cartsum">总计(不含运费)：</span>
					<span class="price">¥{{if value='isset($count)'}}{{$count}}{{else}}0.00{{endif}}</span>
					<p>
						<span class="cartsum">已节省：</span>
						<span class="totalFavor">¥0.00</span>
					</p>
				</div>

			</div>
		</div>

		</form>
		{{include file="../Common/footer"}}
	</body>
</html>
